//
//  Common.h
//  YuDou
//
//  Created by yingqi on 2018/6/22.
//  Copyright © 2018年 yingqi. All rights reserved.
//

#ifndef Common_h
#define Common_h


#define NormalCellID  @"NormalCellID"
#define HeaderViewID  @"HeaderViewID"
#define PrettyCellID  @"PrettyCellID"
#define CycleCellID  @"CycleCellID"

#define kNavBarH 44
#define kTabBarH 44
#define kStatusBarH 20
#define kMenuViewH 200
#define kTitleViewH 40
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

#define kItemMargin  10
#define kHeaderViewH 50

#define kNormalItemW (kScreenWidth - 3 * kItemMargin) / 2
#define kNormalItemH  kNormalItemW * 3 / 4
#define kPrettyItemH  kNormalItemW * 5 / 4



#define kColor(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define kNormalColor kColor(85,85,85)
#define kSelectColor kColor(255,128,0)

// 单例
// @interface
#define singleton_interface(className) \
+ (className *)shared##className;

// @implementation
#define singleton_implementation(className) \
static className *_instance; \
+ (id)allocWithZone:(NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [super allocWithZone:zone]; \
}); \
return _instance; \
} \
+ (className *)shared##className \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [[self alloc] init]; \
}); \
return _instance; \
}



#endif  
